﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

 
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;


namespace MathNetDemo.Startup
{
    internal class Stage_00_TestDemo
    {
        public static void Run()
        {
            Matrix<double> A = DenseMatrix.OfArray(new double[,] {
                {1,1,1,1},
                {1,2,3,4},
                {4,3,2,1}});
            Vector<double>[] nullspace = A.Kernel();

            // verify: the following should be approximately (0,0,0)
            // (A * (2 * nullspace[0] - 3 * nullspace[1]))
            Console.WriteLine(nullspace[0]);
            Console.WriteLine(nullspace[1]);

           var result = A * (2 * nullspace[0] - 3 * nullspace[1]);
            Console.WriteLine(
                "verify:   should be approximately (0,0,0)\n" +
                result);
        }
    }
    
}
